﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {
    import Engine.Classes.*;
    import flash.display.*;

    public class AnimatedBitmapRoundRobbin extends AnimatedBitmap {

        protected static const DRAW_TIME:Number = 4;

        protected var m_drawTime:Number = 0;
        protected var m_delayTime:Number = 0;
        protected var m_drawing:Boolean = true;
        protected var m_firstDelay:Boolean = false;
        protected var m_enableRoundRobbin:Boolean = false;
        protected var m_frameDelay:Number;

        public function AnimatedBitmapRoundRobbin(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:Number){
            super(_arg1, _arg2, _arg3, _arg4, _arg5);
            this.m_frameDelay = ((_arg5)>0) ? (1 / _arg5) : 0;
        }
        public function get frameDelay():Number{
            return (this.m_frameDelay);
        }
        public function set roundRobbin(_arg1:Boolean):void{
            this.m_enableRoundRobbin = _arg1;
        }
        override public function onUpdate(_arg1:Number):void{
            if (!this.m_enableRoundRobbin){
                super.onUpdate(_arg1);
                return;
            };
            var _local2:int = Global.world.defCon;
            if (_local2 >= GameWorld.DEFCON_LEVEL2){
                if (_local2 >= GameWorld.DEFCON_LEVEL4){
                    return;
                };
                if (this.m_drawing){
                    this.m_drawTime = (this.m_drawTime - _arg1);
                    if (this.m_drawTime < 0){
                        this.m_drawing = false;
                        this.m_delayTime = ((_local2)==GameWorld.DEFCON_LEVEL2) ? DRAW_TIME : (3 * DRAW_TIME);
                        this.m_delayTime = (this.m_delayTime + Math.random());
                        if (this.m_firstDelay){
                            this.m_delayTime = (this.m_delayTime * Math.random());
                            this.m_firstDelay = false;
                        };
                    };
                } else {
                    this.m_delayTime = (this.m_delayTime - _arg1);
                    if (this.m_delayTime < 0){
                        this.m_drawing = true;
                        this.m_drawTime = (DRAW_TIME + Math.random());
                    };
                };
            } else {
                this.m_drawing = true;
                this.m_firstDelay = true;
                if (this.m_drawTime == 0){
                    this.m_drawTime = (DRAW_TIME * Math.random());
                };
            };
            if (this.m_drawing){
                super.onUpdate(_arg1);
            };
        }
        override protected function draw():void{
            super.draw();
        }

    }
}//package Classes 
